import sys
import os
# 获取父目录的绝对路径
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
# 将父目录添加到sys.path
sys.path.append(parent_dir)
from utils.log import logger
from utils.chatglm_utils import ChatGLMUtils
from modules.header_recognition import HeaderRecognition
from modules.norm_recognition import NormRecognition
if __name__ == "__main__":
    hpath = '/home/cike/ytc/val-reg-with-glm/data/new_header.json'
    glm_util = ChatGLMUtils()
    glm_util.load_model(local_loading=True, model_path=f"/home/cike/ytc/GLM2/checkpoints/Lora7_25_combine/checkpoint-64000/pytorch_model.bin",
    cuda_index=4)
    hedaer_reg=HeaderRecognition(glm_util,hpath)
    norm_reg=NormRecognition(glm_util,hpath)
    query = "去年12月合同金额总和大于500万的分部有多少？"
    query = norm_reg.recognize(query)
    print(query)
    print(hedaer_reg.recognize(query))